import React, { Component } from 'react'
import { Form, Input, Button, Row, Col, DatePicker } from 'antd'
import { withRouter } from 'react-router-dom'

class CommPageHeader extends Component {
    constructor(props) {
        super(props)
    }
    disabledDate(current) {
        return current < new Date() - 24 * 60 * 1000 * 60;
    }
    onPanelChangeFn(type, value, dateString) {
        console.log(type, value, dateString);
    }
    render() {
        const timeFormat = "YYYY-MM-DD";
        return (
            <>
                <div className="comm-tip mg-t-10">
                    <h2>学期时间说明：</h2>
                    <p>1、学期最后一个月的学期评价报告，在学期结束的第二天0:00生成。</p>
                    <p>2、可设置当前学年及下一学年的上下学期起止时间。学期时间内，可调整学期起止时间；学期结束后，不可再调整该学期结束时间。</p>
                    <p>3、默认学期起止时间：上学期：9月1日——1月31日；下学期：3月1日——6月30日。</p>
                </div>
                <div className="school_time">
                    <Form>
                        <h2 className="comm-title">当前学年：2019学年</h2>
                        <Form.Item label="上学期">
                            <DatePicker format={timeFormat} disabledDate={this.disabledDate} onChange={this.onPanelChangeFn.bind(this, 'type')}></DatePicker>
                            <label className="pd-lr-15">至</label>
                            <DatePicker format={timeFormat} disabledDate={this.disabledDate} onChange={this.onPanelChangeFn.bind(this, 'type')}></DatePicker>
                        </Form.Item>
                        <Form.Item label="下学期">
                            <DatePicker format={timeFormat} disabledDate={this.disabledDate} onChange={this.onPanelChangeFn.bind(this, 'type')}></DatePicker>
                            <label className="pd-lr-15">至</label>
                            <DatePicker format={timeFormat} disabledDate={this.disabledDate} onChange={this.onPanelChangeFn.bind(this, 'type')}></DatePicker>
                        </Form.Item>
                        <h2 className="comm-title">当前学年：2019学年</h2>
                        <Form.Item label="上学期">
                            <DatePicker format={timeFormat} disabledDate={this.disabledDate} onChange={this.onPanelChangeFn.bind(this, 'type')}></DatePicker>
                            <label className="pd-lr-15">至</label>
                            <DatePicker format={timeFormat} disabledDate={this.disabledDate} onChange={this.onPanelChangeFn.bind(this, 'type')}></DatePicker>
                        </Form.Item>
                        <Form.Item label="下学期">
                            <DatePicker format={timeFormat} disabledDate={this.disabledDate} onChange={this.onPanelChangeFn.bind(this, 'type')}></DatePicker>
                            <label className="pd-lr-15">至</label>
                            <DatePicker format={timeFormat} disabledDate={this.disabledDate} onChange={this.onPanelChangeFn.bind(this, 'type')}></DatePicker>
                        </Form.Item>

                        <Button type="primary">保存</Button>
                    </Form>
                </div>
            </>
        )
    }
}
export default withRouter(CommPageHeader)